/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import dto.OrderStatus;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

/**
 *
 * @author duonghung1369
 */
public class OrderStatusDAO extends BaseDAO<OrderStatus> {

    public OrderStatusDAO(Class<OrderStatus> clazz) {
        super(clazz);
    }

    public Object getByName(String desc) {
        session.beginTransaction();
        Criteria criteria = session.createCriteria(OrderStatus.class);
        Object status = criteria.add(Restrictions.like("description", desc)).uniqueResult();
        session.getTransaction().commit();
        return status;
    }
}
